import java.io.*;
import java.util.Hashtable;

public final class Cls_3 extends InputStream
    implements DataInput
{

    public int fld_7;
    public int fld_8;
    public DataInputStream fld_9;
    public int fld_10;
    public InputStream fld_11;
    public byte fld_12[];
    public int fld_13;
    public int fld_14;
    public int fld_15;
    public int fld_16;
    public int fld_17;
    public int fld_18;
    public Cls_16 fld_19;
    public byte fld_20[];
    public int fld_21;
    public int fld_22;
    public int fld_23;
    public int fld_24;
    public static int fld_25[] = new int[29];
    public static int fld_26[] = new int[30];
    public short fld_27[];
    public short fld_28[];
    public byte fld_29[];
    public Cls_3 fld_30;
    public Object fld_31[];
    public int fld_32[];
    public Hashtable fld_33;
    public boolean fld_34;
    public boolean fld_35;
    public int fld_36;
    public long fld_37;
    public InputStream fld_38;

    public final byte readByte()
    {
        return (byte)mth_6();
    }

    public final int mth_1()
    {
        if(fld_8 == fld_10)
        {
            return -1;
        } else
        {
            fld_8++;
            return fld_9.readByte();
        }
    }

    public final int readUnsignedByte()
    {
        return mth_6();
    }

    public final int mth_2()
    {
        if(fld_8 + 2 > fld_10)
        {
            return -1;
        } else
        {
            fld_8 += 2;
            return fld_9.readShort();
        }
    }

    private int mth_3()
    {
        int i;
        int j;
        for(j = (i = mth_6()) & 0x7f; (i & 0x80) != 0; j |= i & 0x7f)
        {
            j <<= 7;
            i = mth_6();
        }

        return j;
    }

    public Cls_3()
    {
    }

    public final short readShort()
    {
        return (short)mth_3();
    }

    public static Cls_3 mth_4(int i)
    {
        Cls_3 cls_3 = new Cls_3();
        i &= 0x7fff;
        cls_3.fld_9 = new DataInputStream(new ByteArrayInputStream(Cls_16.mth_390()));
        Cls_16 cls_16 = Cls_16.mth_110();
        int j = cls_3.fld_9.readShort();
        Cls_16.mth_237(cls_3.fld_9, j);
        cls_3.fld_9.readShort();
        j = i * 6 + 6;
        int k = cls_16.mth_547(i);
        cls_3.fld_10 = cls_16.mth_567(i);
        Cls_16.mth_237(cls_3.fld_9, k + j);
        return cls_3;
    }

    public final int mth_5(int i)
    {
        i = Math.min(i, fld_10 - fld_8);
        Cls_16.mth_237(fld_9, i);
        return i;
    }

    public Cls_3(InputStream inputstream, int i)
    {
        fld_7 = 3;
        fld_38 = inputstream;
    }

    public Cls_3(Object aobj[], int ai[], int i)
    {
        fld_7 = 2;
        fld_20 = new byte[1];
        fld_31 = aobj;
        fld_32 = ai;
        fld_36 = i;
        ai[46] = 0;
        fld_33 = (Hashtable)aobj[9];
        aobj[9] = null;
    }

    public Cls_3(InputStream inputstream)
    {
        fld_7 = -1;
        fld_11 = inputstream;
        fld_12 = new byte[1024];
    }

    private int mth_6()
    {
        int i;
        if((i = fld_38.read()) == -1)
            throw new EOFException();
        else
            return i;
    }

    public Cls_3(int i)
    {
        fld_7 = 1;
        fld_10 = 6;
        fld_27 = new short[574];
        fld_28 = new short[62];
        fld_29 = new byte[288];
    }

    private int mth_7()
    {
        while(fld_21 >= fld_22) 
            fld_19.mth_407(true);
        fld_17++;
        return fld_20[fld_21++] & 0xff;
    }

    public final boolean readBoolean()
    {
        return mth_6() != 0;
    }

    private int mth_8(short aword0[])
    {
        int i;
        for(i = 0; i >= 0;)
        {
            if(fld_24 == 0)
            {
                fld_23 = mth_7();
                fld_24 = 8;
            }
            i = aword0[i + (fld_23 & 1)];
            fld_23 >>>= 1;
            fld_24--;
        }

        return i & 0xfff;
    }

    public final void mth_9(int i)
    {
        mth_10(new byte[32768]);
    }

    public final void mth_10(byte abyte0[])
    {
        fld_12 = abyte0;
        fld_8 = abyte0.length;
        if(fld_26[0] == 0)
        {
            fld_26[0] = 1;
            fld_26[1] = 2;
            for(abyte0 = 1; abyte0 < 29; abyte0++)
                fld_26[abyte0 + 1] = (1 << (abyte0 >> 1)) + (1 << (abyte0 - 1 >> 1)) + 1;

            abyte0 = 0;
            int i = 3;
            for(; abyte0 < 28; abyte0++)
            {
                fld_25[abyte0] = i;
                i += abyte0 >= 8 ? 1 << (abyte0 - 4 >> 2) : 1;
            }

            fld_25[28] = 258;
        }
    }

    public final void mth_11(byte abyte0[], int i, int j)
    {
        fld_20 = abyte0;
        fld_21 = i;
        fld_22 = i + j;
    }

    private int mth_12(int i)
    {
        int j = 0;
        for(int k = 0; k < i; k++)
        {
            if(fld_24 == 0)
            {
                fld_23 = mth_7();
                fld_24 = 8;
            }
            j |= (fld_23 & 1) << k;
            fld_23 >>>= 1;
            fld_24--;
        }

        return j;
    }

    private static void mth_13(byte abyte0[], int i, short aword0[])
    {
        for(int j = 0; j < aword0.length; j++)
            aword0[j] = 0;

        short word0 = 2;
        int k = 0;
        for(int l = 1; l <= 16; l++)
        {
            for(short word1 = 0; word1 < i; word1++)
            {
                if(abyte0[word1] != l)
                    continue;
                int i1 = 0;
                int j1 = l - 1;
                do
                {
                    if(j1 < 0)
                        break;
                    if((k & 1 << j1) != 0)
                        i1++;
                    if(j1 == 0)
                        break;
                    if(aword0[i1] == 0)
                    {
                        aword0[i1] = word0;
                        i1 = word0;
                        word0 += 2;
                        j1--;
                    } else
                    {
                        i1 = aword0[i1];
                        j1--;
                    }
                } while(true);
                aword0[i1] = (short)(word1 | 0x8000);
                k++;
            }

            k <<= 1;
        }

    }

    private byte[] mth_14(short aword0[], int i)
    {
        byte abyte0[] = new byte[i];
        int k;
        for(int j = 0; j < i;)
            if((k = mth_8(aword0)) < 16)
            {
                abyte0[j++] = (byte)k;
            } else
            {
                int l = mth_12(k != 18 ? k - 14 : 7) + 3;
                if(k == 18)
                    l += 8;
                if(k > 16)
                    k = 0;
                else
                    k = abyte0[j - 1];
                while(l-- > 0) 
                    abyte0[j++] = k;
            }

        return abyte0;
    }

    public final char readChar()
    {
        return (char)mth_3();
    }

    private boolean mth_15()
    {
        while(fld_16-- > 0) 
        {
            fld_12[fld_13++] = fld_12[fld_14++];
            if(fld_14 == fld_8)
                fld_14 = 0;
            if(fld_15 == fld_13)
                return true;
        }
        return false;
    }

    private boolean mth_16()
    {
        if(fld_16 > 0 && mth_15())
            return true;
        int i;
        while((i = mth_8(fld_27)) != 256) 
        {
            if(i > 256)
            {
                i -= 257;
                fld_16 = fld_25[i];
                if(i > 7 && i != 28)
                    fld_16 += mth_12((i >> 2) - 1);
                i = mth_8(fld_28);
                int j = fld_26[i];
                if(i > 3)
                    j += mth_12((i >> 1) - 1);
                fld_14 = fld_13 - j;
                if(fld_14 < 0)
                    fld_14 = fld_8 + fld_14;
                if(mth_15())
                    return true;
            } else
            {
                fld_12[fld_13++] = (byte)i;
            }
            if(fld_15 == fld_13)
                return true;
        }
        return false;
    }

    public final void mth_17(Cls_16 cls_16, int i)
    {
        fld_19 = cls_16;
        fld_24 = i;
    }

    public final void mth_18()
    {
        fld_19 = null;
    }

    public final int readUnsignedShort()
    {
        return mth_3();
    }

    public final Cls_3 mth_19(Cls_3 cls_3)
    {
        if(cls_3 == this)
        {
            cls_3 = fld_30;
            fld_30 = null;
            return cls_3;
        }
        Cls_3 cls_3_1 = this;
        do
        {
            if(cls_3_1.fld_30 == null)
                break;
            if(cls_3_1.fld_30 == cls_3)
            {
                cls_3_1.fld_30 = cls_3.fld_30;
                cls_3.fld_30 = null;
                break;
            }
            cls_3_1 = cls_3_1.fld_30;
        } while(true);
        return this;
    }

    public final Hashtable mth_20(boolean flag)
    {
        Hashtable hashtable = fld_33;
        if(flag)
            fld_33 = null;
        return hashtable;
    }

    public final String readUTF()
    {
        return null;
    }

    public final void mth_21()
    {
        fld_31 = null;
        fld_32 = null;
    }

    public final boolean mth_22()
    {
        return fld_31 == null;
    }

    public final boolean mth_23()
    {
        return fld_32[46] != 0;
    }

    public final synchronized void mth_24(int i)
    {
        fld_18 = i;
        fld_29 = null;
        notifyAll();
    }

    public final void mth_25()
    {
        fld_32[46] = 1;
    }

    public final void mth_26()
    {
        fld_35 = true;
    }

    public final void mth_27(int i)
    {
        fld_34 = true;
        fld_22 = i;
    }

    public final void mth_28(int i)
    {
        fld_17 += i;
    }

    public final boolean mth_29()
    {
        if(fld_19 == null)
            return false;
        else
            return fld_19.fld_124;
    }

    public final int mth_30()
    {
        return (int)(System.currentTimeMillis() - fld_37);
    }

    public final void mth_31()
    {
        fld_37 = System.currentTimeMillis();
    }

    public final boolean mth_32()
    {
        return fld_19.mth_160();
    }

    public final boolean mth_33()
    {
        return fld_19.mth_187();
    }

    public final int readInt()
    {
        Cls_3 cls_3;
        if(fld_7 != 3)
        {
            if((cls_3 = this).fld_8 + 4 > cls_3.fld_10)
            {
                return -1;
            } else
            {
                cls_3.fld_8 += 4;
                return cls_3.fld_9.readInt();
            }
        } else
        {
            return mth_3();
        }
    }

    public final long readLong()
    {
        Cls_3 cls_3;
        if(fld_7 != 3)
        {
            if((cls_3 = this).fld_8 + 8 > cls_3.fld_10)
            {
                return (long)-1;
            } else
            {
                cls_3.fld_8 += 8;
                return cls_3.fld_9.readLong();
            }
        } else
        {
            return (long)-1;
        }
    }

    public final int skipBytes(int i)
    {
        return (int)skip(i);
    }

    public final int read()
    {
        if(fld_7 != 3)
        {
            Cls_3 cls_3;
            if((cls_3 = this).fld_7 != 2)
                if((cls_3 = cls_3).fld_7 != 1)
                {
                    int i;
                    if((cls_3 = cls_3).fld_7 != -1)
                        if((i = (cls_3 = cls_3).fld_9.read()) < 0)
                        {
                            return -1;
                        } else
                        {
                            cls_3.fld_8++;
                            return i;
                        }
                    if((cls_3 = cls_3).fld_10 == cls_3.fld_8)
                    {
                        cls_3.fld_8 = cls_3.fld_11.read(cls_3.fld_12);
                        if(cls_3.fld_8 < 0)
                            return -1;
                        cls_3.fld_10 = 0;
                    }
                    return cls_3.fld_12[cls_3.fld_10++] & 0xff;
                } else
                {
                    (cls_3 = cls_3).read(null, 0, 1);
                    return cls_3.fld_12[cls_3.fld_13 - 1] & 0xff;
                }
            if(cls_3.read((cls_3 = cls_3).fld_20, 0, 1) < 0)
                return -1;
            else
                return cls_3.fld_20[0] & 0xff;
        } else
        {
            return fld_38.read();
        }
    }

    public final void readFully(byte abyte0[], int i, int j)
    {
        if(fld_38.read(abyte0, i, j) < j)
            throw new EOFException();
        else
            return;
    }

    public final void readFully(byte abyte0[])
    {
        if(fld_38.read(abyte0) < abyte0.length)
            throw new EOFException();
        else
            return;
    }

    public final void close()
    {
        Cls_3 cls_3;
        if(fld_7 != 3)
        {
            if((cls_3 = this).fld_7 != 2)
            {
                if((cls_3 = cls_3).fld_7 != 1)
                {
                    if((cls_3 = cls_3).fld_7 != -1)
                    {
                        (cls_3 = cls_3).fld_9.close();
                        cls_3.fld_9 = null;
                        return;
                    } else
                    {
                        cls_3.InputStream.close();
                        return;
                    }
                } else
                {
                    cls_3.InputStream.close();
                    return;
                }
            } else
            {
                Cls_16.mth_181(cls_3, false);
                return;
            }
        } else
        {
            super.close();
            return;
        }
    }

    public final int read(byte abyte0[], int i, int j)
    {
        if(fld_7 != 3)
        {
            abyte0 = j;
            i = i;
            j = abyte0;
            Cls_3 cls_3 = this;
            if(fld_7 != 2)
            {
                if((cls_3 = cls_3).fld_7 != 1)
                {
                    if((cls_3 = cls_3).fld_7 != -1)
                        if((cls_3 = cls_3).fld_8 == cls_3.fld_10 && abyte0 > 0)
                        {
                            return -1;
                        } else
                        {
                            abyte0 = cls_3.fld_9.read(j, i, Math.min(abyte0, cls_3.fld_10 - cls_3.fld_8));
                            cls_3.fld_8 += abyte0;
                            return abyte0;
                        }
                    if(j == null)
                        throw new NullPointerException();
                    if(i < 0 || abyte0 < 0 || i + abyte0 > j.length)
                        throw new IndexOutOfBoundsException();
                    if(abyte0 == 0)
                        return 0;
                    int k = 0;
                    if(cls_3.fld_10 == cls_3.fld_8)
                    {
                        if((k = cls_3.read()) < 0)
                            return -1;
                        j[i++] = (byte)k;
                        abyte0--;
                        k = 1;
                    }
                    if((abyte0 = Math.min(cls_3.fld_8 - cls_3.fld_10, abyte0)) > 0)
                    {
                        System.arraycopy(cls_3.fld_12, cls_3.fld_10, j, i, abyte0);
                        cls_3.fld_10 += abyte0;
                    }
                    return k + abyte0;
                }
                (cls_3 = cls_3).fld_17 = 0;
                if(cls_3.fld_13 == cls_3.fld_8)
                    cls_3.fld_13 = 0;
                abyte0 = cls_3.fld_8 - cls_3.fld_13;
                byte abyte1[] = abyte0;
                abyte0 = abyte0 >= abyte0 ? abyte0 : abyte1;
                cls_3.fld_15 = cls_3.fld_13 + abyte0;
                abyte0 = cls_3.fld_13;
label0:
                do
                {
                    if(cls_3.fld_15 == cls_3.fld_13 || cls_3.fld_21 >= cls_3.fld_22)
                        break;
label1:
                    switch(cls_3.fld_10)
                    {
                    case 6: // '\006'
                    default:
                        break;

                    case 7: // '\007'
                        return 0;

                    case 0: // '\0'
                        cls_3.fld_24 = 0;
                        cls_3.fld_16 = cls_3.mth_12(16);
                        cls_3.mth_12(16);
                        cls_3.fld_10 = 3;
                        // fall through

                    case 3: // '\003'
                        do
                        {
                            if(cls_3.fld_16 <= 0)
                                break label1;
                            cls_3.fld_16--;
                            cls_3.fld_12[cls_3.fld_13++] = (byte)cls_3.mth_7();
                        } while(cls_3.fld_15 != cls_3.fld_13);
                        break label0;

                    case 1: // '\001'
                        int l;
                        for(l = 0; l < 144; l++)
                            cls_3.fld_29[l] = 8;

                        for(; l < 256; l++)
                            cls_3.fld_29[l] = 9;

                        for(; l < 280; l++)
                            cls_3.fld_29[l] = 7;

                        for(; l < 288; l++)
                            cls_3.fld_29[l] = 8;

                        mth_13(cls_3.fld_29, 288, cls_3.fld_27);
                        for(int i1 = 0; i1 < 32; i1++)
                            cls_3.fld_29[i1] = 5;

                        mth_13(cls_3.fld_29, 32, cls_3.fld_28);
                        cls_3.fld_10 = 4;
                        // fall through

                    case 4: // '\004'
                        if(cls_3.mth_16())
                            break label0;
                        break;

                    case 2: // '\002'
                        int j1 = cls_3.mth_12(5) + 257;
                        int k1 = cls_3.mth_12(5) + 1;
                        int l1 = cls_3.mth_12(4) + 4;
                        for(int i2 = 0; i2 < 19; i2++)
                        {
                            int j2;
                            if(i2 < 3)
                                j2 = i2 + 16;
                            else
                            if(i2 == 3)
                                j2 = 0;
                            else
                            if((i2 & 1) == 1)
                                j2 = 7 - (i2 - 5 >>> 1);
                            else
                                j2 = 8 + (i2 - 4 >>> 1);
                            cls_3.fld_29[j2] = i2 >= l1 ? 0 : (byte)cls_3.mth_12(3);
                        }

                        short aword0[] = new short[36];
                        mth_13(cls_3.fld_29, 19, aword0);
                        mth_13(cls_3.mth_14(aword0, j1), j1, cls_3.fld_27);
                        mth_13(cls_3.mth_14(aword0, k1), k1, cls_3.fld_28);
                        cls_3.fld_10 = 5;
                        // fall through

                    case 5: // '\005'
                        if(cls_3.mth_16())
                            break label0;
                        break;
                    }
                    if(cls_3.fld_18 == 1)
                    {
                        cls_3.fld_10 = 7;
                        break;
                    }
                    cls_3.fld_18 = cls_3.mth_12(1);
                    cls_3.fld_10 = cls_3.mth_12(2);
                } while(true);
                if(j != null)
                    System.arraycopy(cls_3.fld_12, abyte0, j, i, cls_3.fld_13 - abyte0);
                return cls_3.fld_13 - abyte0;
            }
            (cls_3 = cls_3).fld_21 = i;
            cls_3.fld_18 = abyte0;
            cls_3.fld_29 = j;
            Cls_16.mth_155(cls_3);
            do
            {
                Cls_16 cls_16;
                if((cls_16 = cls_3.fld_19) != null)
                    cls_16.mth_405(cls_3);
                if(cls_3.fld_34)
                    if(cls_3.fld_35)
                        return -1;
                    else
                        throw new IOException();
                if(cls_3.fld_29 == null)
                    if(cls_3.fld_18 == 0)
                        return cls_3.read(j, i, abyte0);
                    else
                        return cls_3.fld_18;
                Cls_16.mth_156(cls_3, 1000);
            } while(true);
        } else
        {
            return super.read(abyte0, i, j);
        }
    }

}